/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Models;

import Controllers.DBUtility;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author HUY
 */
public class Cases {
    //var

    private int caseID;
    private String caseType;
    private Date caseTime;
    private Date reportedTime;
    private Date approvalDate;
    private String casePlace;
    private String caseDescriptions;
    private String caseInvolvements;
    private int caseStatus;
    private boolean prosecutionDesire;
    private int leadOfficerID;
    private int approvalDirectorID;

    public Date getApprovalDate() {
        return approvalDate;
    }

    public void setApprovalDate(Date approvalDate) {
        this.approvalDate = approvalDate;
    }

    public int getApprovalDirectorID() {
        return approvalDirectorID;
    }

    public void setApprovalDirectorID(int approvalDirectorID) {
        this.approvalDirectorID = approvalDirectorID;
    }

    public String getCaseDescriptions() {
        return caseDescriptions;
    }

    public void setCaseDescriptions(String caseDescriptions) {
        this.caseDescriptions = caseDescriptions;
    }

    public int getCaseID() {
        return caseID;
    }

    public void setCaseID(int caseID) {
        this.caseID = caseID;
    }

    public String getCaseInvolvements() {
        return caseInvolvements;
    }

    public void setCaseInvolvements(String caseInvolvements) {
        this.caseInvolvements = caseInvolvements;
    }

    public String getCasePlace() {
        return casePlace;
    }

    public void setCasePlace(String casePlace) {
        this.casePlace = casePlace;
    }

    public int getCaseStatus() {
        return caseStatus;
    }

    public void setCaseStatus(int caseStatus) {
        this.caseStatus = caseStatus;
    }

    public Date getCaseTime() {
        return caseTime;
    }

    public void setCaseTime(Date caseTime) {
        this.caseTime = caseTime;
    }

    public String getCaseType() {
        return caseType;
    }

    public void setCaseType(String caseType) {
        this.caseType = caseType;
    }

    public int getLeadOfficerID() {
        return leadOfficerID;
    }

    public void setLeadOfficerID(int leadOfficerID) {
        this.leadOfficerID = leadOfficerID;
    }

    public boolean isProsecutionDesire() {
        return prosecutionDesire;
    }

    public void setProsecutionDesire(boolean prosecutionDesire) {
        this.prosecutionDesire = prosecutionDesire;
    }

    public Date getReportedTime() {
        return reportedTime;
    }

    public void setReportedTime(Date reportedTime) {
        this.reportedTime = reportedTime;
    }

    public Cases() {
    }

    public Cases(int caseID) {
        Connection conn = DBUtility.openConnection();
        PreparedStatement stm = null;
        ResultSet rs = null;
        try {
            stm = conn.prepareStatement("select CasePlace,CaseDescriptions,CaseInvolvements from [CrimeFile].[dbo].Cases  where caseID = ?");
            stm.setInt(1, caseID);
            rs = stm.executeQuery();
            if (rs.next()) {
                this.casePlace = rs.getString("CasePlace");
                this.caseDescriptions = rs.getString("CaseDescriptions");
                this.caseInvolvements = rs.getString("CaseInvolvements");
                
            }
            }  catch (SQLException ex) {
            Logger.getLogger(Cases.class.getName()).log(Level.SEVERE, null, ex);
        }


    }
}

